using System;
using System.Collections.Generic;
using System.Text;

namespace GraphAlgsPresentation.ScriptLibrary
{
    /// <summary>
    /// Provides a delay command
    /// </summary>
    [Serializable]
    public class Delay : Command
    {
        private int _timeOut;

        /// <summary>
        /// Gets or sets delay time
        /// </summary>
        public int TimeOut
        {
            get { return _timeOut; }
            set { _timeOut = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Delay"/> class.
        /// </summary>
        public Delay()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Delay"/> class.
        /// </summary>
        /// <param name="timeOut">Delay time</param>
        public Delay(int timeOut)
        {
            this.TimeOut = timeOut;
        }

        /// <summary>
        /// Runs this instance.
        /// </summary>
        public override void Run()
        {
            System.Threading.Thread.Sleep(this.TimeOut);
        }

        /// <summary>
        /// Undoes this instance.
        /// </summary>
        public override void Undo()
        {
            //throw new Exception("The method or operation is not implemented.");
        }
    }
}
